#
# Makefile for max_2d_main.c RUN: typing make in this directory
#
# CFLAGS=-c -O3 -Wall -g
#CC=gcc
#CFLAGS= -O3 -Wall -ggdb3
#for lam mpi
#CC=hcc
#for mpich, open mpi
#CC=mpicc
CC=mpicc.openmpi
CFLAGS=-O3 -g
# $(CC) $(CFLAGS)

all: wave_2d.exec wave_2d_main.o adisco_2d.o inidat.o  integ.o rkc.o wave_2d_eq.o derivs_2d.o util.o input.o 

wave_2d.exec: wave_2d_main.c first_macro_2d.h structs_2d.h gen_2d.h wave_2d_main.o inidat.o integ.o rkc.o adisco_2d.o wave_2d_eq.o derivs_2d.o util.o input.o 
	$(CC) $(CFLAGS) -L/usr/local/lib -L. -L/opt/lam/include -I/usr/include -ffast-math -finline-functions -Wstrict-prototypes -o wave_2d.exec wave_2d_main.o inidat.o integ.o rkc.o adisco_2d.o wave_2d_eq.o derivs_2d.o util.o input.o   -lm -lbbhutil -lmpi #-lsv -lefence 

wave_2d_main.o: first_macro_2d.h structs_2d.h gen_2d.h wave_2d_main.c
	$(CC) $(CFLAGS) -c -o wave_2d_main.o wave_2d_main.c

adisco_2d.o: first_macro_2d.h structs_2d.h gen_2d.h adisco_2d.c
	$(CC) $(CFLAGS) -c -o adisco_2d.o adisco_2d.c

inidat.o: first_macro_2d.h structs_2d.h gen_2d.h  inidat.c
	$(CC) $(CFLAGS) -c -o inidat.o inidat.c

integ.o: first_macro_2d.h structs_2d.h gen_2d.h integ.c
	$(CC) $(CFLAGS) -c -finline-functions -o integ.o integ.c

rkc.o: first_macro_2d.h structs_2d.h gen_2d.h rkc.c
	$(CC) $(CFLAGS) -c -finline-functions -o rkc.o rkc.c

wave_2d_eq.o: wave_2d_eq.c wave_2d_eq_eq.c  wave_2d_face.c first_macro_2d.h structs_2d.h gen_2d.h
	$(CC) $(CFLAGS) -c -finline-functions -o wave_2d_eq.o wave_2d_eq.c

input.o: input.c first_macro_2d.h structs_2d.h gen_2d.h
	$(CC) $(CFLAGS) -c -o input.o input.c

#output.o: output.c first_macro_2d.h structs_2d.h gen_2d.h
#	$(CC) $(CFLAGS) -c -o output.o output.c

derivs_2d.o: derivs_2d.c first_macro_2d.h structs_2d.h gen_2d.h derivs_2d.h
	$(CC) $(CFLAGS) -c -ffast-math -finline-functions -o derivs_2d.o derivs_2d.c

#createfields_2d.o:  createfields_2d.c first_macro_2d.h structs_2d.h gen_2d.h 
#	$(CC) $(CFLAGS) -c -ffast-math -finline-functions -o  createfields_2d.o createfields_2d.c

#binio.o: binio.c
#	$(CC) $(CFLAGS) -c -DLITTLE -o binio.o binio.c

#java_ser.o: java_ser.c
#	$(CC) $(CFLAGS) -c -DLITTLE -I/usr/include -o java_ser.o java_ser.c

#java_fser.o: java_fser.c
#	$(CC) $(CFLAGS) -c -DLITTLE -I/usr/include -o java_fser.o java_fser.c


#tranSVFile: tranSVFile.o binio.o
#	$(CC) $(CFLAGS) tranSVFile.o binio.o -o tranSVFile



# For SUN (big endian)

#binio.o: binio.c  
#	gcc -c -Wall  -o binio.o binio.c 

#java_ser.o: java_ser.c  
#	gcc -c -Wall  -I/usr/include -o java_ser.o java_ser.c 

util.o: util.c
	$(CC) $(CFLAGS) -c -o util.o util.c


clean:
	rm -f *.o *.exec tranSVFile core *~ *.dvi *.aux *.log 

limpia_Dump: 
	rm -f Dump/run_*
